package com.sayp.netdisk.service;

import com.sayp.netdisk.dao.*;
import com.sayp.netdisk.pojo.File;
import com.sayp.netdisk.pojo.Format;
import com.sayp.netdisk.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SearchService {
    @Autowired
    private SearchDao searchDao;
    @Autowired
    private FileService fileService;

    /**
     * 根据当前目录id查询所有文件
     * @param parentId
     * @return
     */
    public List<File> findFile(int parentId, int cid, String search, int uid){
        List<File> files = searchDao.findByParentIdCidAndFName(parentId, cid, search,uid);
        return fileService.setFile(files);
    }
    /**
     * 根据当前目录id该目录下及子目录文件
     * @param parentId
     * @return
     */
    public List<File> findFile1(int parentId, int cid, String search, int uid){
        List<File> files = searchDao.findByParentIdCidAndFName1(parentId, cid, search,uid);
        return fileService.setFile(files);
    }



}
